/**
 * @param {number} left
 * @param {number} right
 * @return {number}
 */
 var countPrimeSetBits = function(left, right) {
  let arr = [0,0,1,1,0,1,0,1,0,0,0,1,0,1,0,0],count=0
  for(let i=left;i<=right;i++){
    if(arr[check(i)]) count++
  }

  function check(num){
    let count = 0
    if(num==0||num==1) return count
    while(num){
      if(num==1){
        count++
        return count
      }else if(num==0){
        return count
      }else {
       num%2==0?count+0:count++
       num =Math.floor(num/2)
      }
    }
  }

  return count
};

countPrimeSetBits(6,10)